/*
 * @Author: zhangyongbing
 * @Date: 2022-04-28 13:37:52
 * @LastEditors: zhangyongbing
 * @LastEditTime: 2022-04-28 13:37:53
 * @Description: file content
 * @FilePath: /psys-ppm-web/src/libs/mixins.js
 */
/*
 * @Description: 混入js
 * @Autor: zhangzhanhua
 * @Date: 2021-06-01 15:38:27
 * @LastEditors: zhangzhanhua
 * @LastEditTime: 2021-06-01 15:59:22
 */
/**
 * @description: 混入下拉加载参数
 * @param {*}
 * @return {*}
 * @author: zhangzhanhua
 */
export let selectLoadMixin = {
    data() {
        return {
            //货名下拉数据
            cargoListQuery: {
                startpage: 1,
                pagesize: 20,
                totalPageNum: 0,
                key: ''
            },
            //货主下拉数据
            cargoShipperQuery: {
                startpage: 1,
                pagesize: 20,
                totalPageNum: 0,
                key: ''
            },
            //货代下拉数据
            cargoAgentsQuery: {
                startpage: 1,
                pagesize: 20,
                totalPageNum: 0,
                key: ''
            },
            //船名航次下拉数据
            shipListQuery: {
                startpage: 1,
                pagesize: 20,
                totalPageNum: 0,
                key: ''
            },
            //船代下拉数据
            shipAgentsQuery: {
                startpage: 1,
                pagesize: 20,
                totalPageNum: 0,
                key: ''
            },
        }
    },
}
/**
 * @description: 混入下拉方法
 * @param {*}
 * @return {*}
 * @author: zhangzhanhua
 */
export let selectMethodMixin = {
    methods: {
        loadMore() {
            //v-selectLoadMore='()=>{loadMore("shipAgent")}' 船代下拉
            if (type == 'shipAgent') {
                this.shipAgentsQuery.startpage += 1
                if (this.shipAgentsQuery.totalPageNum < this.shipAgentsQuery.startpage) {
                    return
                }
                this.getShipAgentTypeList({
                    keyword: this.shipAgentsQuery.key,
                })
            }
            //v-selectLoadMore='()=>{loadMore("shipList")}' 船名航次下拉
            if (type == 'shipList') {
                this.shipListQuery.startpage += 1
                if (this.shipListQuery.totalPageNum < this.shipListQuery.startpage) {
                    return
                }
                this.getShipListData(this.shipListQuery.key)
            }
            //v-selectLoadMore='()=>{loadMore("cargoOwner")}' 货主
            if (type == 'cargoOwner') {
                this.cargoShipperQuery.startpage += 1
                if (this.cargoShipperQuery.totalPageNum < this.cargoShipperQuery.startpage) {
                    return
                }
                this.getCargOwner(this.cargoShipperQuery.key)
            }
            // v-selectLoadMore='()=>{loadMore("cargoAgents")}' 货代
            if (type == 'cargoAgents') {
                this.cargoAgentsQuery.startpage += 1
                if (this.cargoAgentsQuery.totalPageNum < this.cargoAgentsQuery.startpage) {
                    return
                }
                this.getCargAgent(this.cargoAgentsQuery.key)
            }
            //v-selectLoadMore='()=>{loadMore("cargoName")}' 货名
            if (type == 'cargoName') {
                this.cargoListQuery.startpage += 1
                if (this.cargoListQuery.totalPageNum < this.cargoListQuery.startpage) {
                    return
                }
                this.getgoods(this.cargoListQuery.key)
            }
        }
    },
}